﻿CREATE TABLE [v1].[Journal] (
    [JournalId]                  INT           IDENTITY (1, 1) NOT NULL,
    [EffectiveDateId]            INT           NOT NULL,
    [JournalBatchId]             INT           NOT NULL,
    [SourceSystemId]             SMALLINT      NOT NULL,
    [SourceJournalId]            INT           NOT NULL,
    [JournalDateId]              INT           NOT NULL,
    [PostingDateId]              INT           NOT NULL,
    [AdjustmentTypeId]           SMALLINT      NOT NULL,
    [AdjustmentClassificationId] SMALLINT      DEFAULT ((-1)) NOT NULL,
    [CurrencyId]                 SMALLINT      NOT NULL,
    [JournalOwnerId]             SMALLINT      NOT NULL,
    [JournalStatusId]            SMALLINT      NOT NULL,
    [JournalPostingUnitId]       SMALLINT      NOT NULL,
    [CreatedBy]                  NVARCHAR (50) DEFAULT (suser_sname()) NULL,
    [UpdatedBy]                  NVARCHAR (50) NULL,
    [UpdatedDate]                DATETIME      NULL,
    [RowChecksumMD5]             CHAR (36)     DEFAULT ('') NULL,
    [RowAuditId]                 INT           DEFAULT ((-1)) NOT NULL,
    PRIMARY KEY CLUSTERED ([JournalId] ASC) WITH (FILLFACTOR = 90, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

